<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .gold {
            width: 400px;
            height: 20px;
            background-color: #e15761;
            border-left: 60px solid #f5dc3a;
            border-right: 60px solid #f5dc3a;
            border-radius: 4px;
        }
    </style>
</head>
<body>
    <div class="gold"></div>
    <button class="plus">+</button>
    <button class="min">-</button>
    <script>
        // 获取元素
        var plus = document.querySelector('.plus');
        var min = document.querySelector('.min');
        var gold = document.querySelector('.gold');
        // 获取宽度
        var width = 520;
        // 绑定事件，添加事件监听
        plus.addEventListener('click', function() {
            width += 20;
            gold.style.width = width+'px'
        })
        min.addEventListener('click', function() {
            width -= 20;
            gold.style.width = width+'px'
        })
    </script>
</body>
</html>